package sets;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.swing.text.DefaultStyledDocument.ElementSpec;

import memberships.MembershipFunction;
import sets.IFuzzySet.Type;
import universe.IUniverseOfDiscourse;
import utils.Element;
import utils.Interval;
import utils.Pair;

public class IntervalFuzzySet1 implements IFuzzySet {

	private IFuzzySet lowerSet;
	private IFuzzySet upperSet;
	
	private List<Element> elements;
	private String column;
	private Type type = Type.INTERVAL;
	
	public IntervalFuzzySet1() {
		lowerSet = new FuzzySetType1();
		upperSet = new FuzzySetType1();
	}
	
	// Methods specified for interval sets
	public void setLowerMembershipFunction(MembershipFunction membershipFunction) {
		lowerSet.setMembershipFunction(membershipFunction);
	}
	
	public void setUpperMembershipFunction(MembershipFunction membershipFunction) {
		upperSet.setMembershipFunction(membershipFunction);
	}
	
	@Override
	public Boolean isEmpty() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Boolean isConcave() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Boolean isConvex() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Boolean isNormal() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public ClassicalSet supp() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Interval sup() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Interval card() {
		double lower_card = lowerSet.card().toDouble();
		double upper_card = upperSet.card().toDouble();
		return new Interval(lower_card, upper_card);
	}
	@Override
	public Interval in() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Interval c() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Interval hgt() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public ClassicalSet core() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public ClassicalSet alphaCut(double alpha) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public IFuzzySet union(IFuzzySet set) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public IFuzzySet intersection(IFuzzySet set) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public IFuzzySet complement(IFuzzySet set) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public void setMembershipFunction(MembershipFunction membershipFunction) {
		// TODO Auto-generated method stub
		
	}
	
	@Override
	public MembershipFunction getMembershipFunction() {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public void setUniverseOfDiscorse(IUniverseOfDiscourse universe) {
		lowerSet.setUniverseOfDiscorse(universe);
		upperSet.setUniverseOfDiscorse(universe);
	}
	
	@Override
	public IUniverseOfDiscourse getUniverseOfDiscorse() {
		// TODO Auto-generated method stub
		// FIXME opis
		return null;
	}
	
	@Override
	public void setElements(List<Element> elements) {
		// TODO Auto-generated method stub
		
	}
	
	@Override
	public List<Element> getElements() {
		// TODO Auto-generated method stub
		
		List<Pair<Element, Element>> elementPairs = new ArrayList<>();
		
		for (int i = 0; i < lowerSet.getElements().size(); ++i) {
			Element element = lowerSet.getElements().get(i);
			Pair<Element, Element> pair = new Pair<>();
			pair.setFirst(element);
			elementPairs.add(pair);
		}
		
		for (int i = 0; i < upperSet.getElements().size(); ++i) {
			Element element = upperSet.getElements().get(i);
			elementPairs.get(i).setSecond(element);
		}
		
		for (Pair<Element, Element> pair : elementPairs) {
			System.out.println(pair);
		}
		
		return null;
	}
	
	@Override
	public void addElement(Double element) {
		lowerSet.addElement(element);
		upperSet.addElement(element);
	}
	@Override
	public void setColumn(String column) {
		this.column = column;
	}
	@Override
	public String getColumn() {
		return column;
	}
	@Override
	public Map<Double, Double> getElementsAsMap() {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public Type getType() {
		return type;
	}
	
	
}
